package api.txInfo;

import android.content.Context;
import android.view.View;

import java.lang.ref.SoftReference;

public abstract class InfoListAPI_TX {

    public static String clazz = "api.txInfo.TX_Info";

    private static SoftReference<InfoListAPI_TX> sf;

    public synchronized static InfoListAPI_TX getInstance() {

        if (sf == null || sf.get() == null) {
            Object o = null;
            try {
                o = Class.forName(clazz).newInstance();
            } catch (ClassNotFoundException e) {
                e.printStackTrace();
            } catch (InstantiationException e) {
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            } catch (IllegalArgumentException e) {
                e.printStackTrace();
            }
            if (o != null) {
                sf = new SoftReference<>((InfoListAPI_TX) o);
                return (InfoListAPI_TX) o;
            }
        }
        return sf == null ? null : sf.get();
    }

    public abstract View loadInfo(Context context, String InfoID, LoadInfoCallBack callBack);

    public interface LoadInfoCallBack {
        void onContentLoaded();

        void onNoContent(int var1);

        void onContentError(int var2);

        void onItemClick();
    }
}
